package myapps.ttclient.activity.ds;

import myapps.ttclient.R;
import myapps.ttclient.app.TTClientApplication;
import myapps.ttclient.protocol.message.drawingscreen.DSSaveRequestMessage;
import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class DSSaveFileActivity extends Activity {
	private TTClientApplication application;
	private SharedPreferences preferences;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		
		this.application = (TTClientApplication) this.getApplication();

		this.preferences = this.application.getPreferences();

		
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.ds_save_file);
		
		etFolderPath = (EditText) findViewById(R.id.etFolderPath);
		etFilePath = (EditText) findViewById(R.id.etFilePath);
		btnSave = (Button) findViewById(R.id.btnSave);
		
		
		etFilePath.requestFocus();
		
		btnSave.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				String strFilePath = etFolderPath.getText().toString() + etFilePath.getText().toString();
				DSSaveFileActivity.this.application.sendMessage(
						new DSSaveRequestMessage(strFilePath));
				
				DSSaveFileActivity.this.application.showToast("Save to " + strFilePath);
				
				DSSaveFileActivity.this.finish();
				
			}
		});
		
	}
	
	private EditText etFolderPath;
	private EditText etFilePath;
	private Button btnSave;
}
